<html>
<head><meta charset="utf-8"><title>Building cargo with toolchain support · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html">Building cargo with toolchain support</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="238514089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Building%20cargo%20with%20toolchain%20support/near/238514089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Will Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html#238514089">(May 12 2021 at 17:37)</a>:</h4>
<p>I'm working on a simultaneous change to cargo and rustc. I'm using rustup to manage my local rustc toolchain. It seems like cargo out-of-the-box doesn't support rustup, e.g. if I do <code>./target/debug/cargo +local whatever</code> then I get the erorr mesage <code>no such subcommand +local</code>. This functionality is not clearly documented anywhere that I could find, so I'm not sure how to get it working. Any suggestions on how to recover this feature?</p>



<a name="238514274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Building%20cargo%20with%20toolchain%20support/near/238514274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html#238514274">(May 12 2021 at 17:38)</a>:</h4>
<p><span class="user-mention" data-user-id="265377">@Will Crichton</span> There is documentation on how to set it up here: <a href="https://doc.crates.io/contrib/process/working-on-cargo.html#running-cargo">https://doc.crates.io/contrib/process/working-on-cargo.html#running-cargo</a></p>



<a name="238514285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Building%20cargo%20with%20toolchain%20support/near/238514285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html#238514285">(May 12 2021 at 17:38)</a>:</h4>
<p>personally I use <code>RUSTC=</code>, but I know there's a way to do it in <code>rustup</code>, I've just never dused it</p>



<a name="238514302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Building%20cargo%20with%20toolchain%20support/near/238514302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html#238514302">(May 12 2021 at 17:38)</a>:</h4>
<p>lol disregard me</p>



<a name="238514546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Building%20cargo%20with%20toolchain%20support/near/238514546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html#238514546">(May 12 2021 at 17:40)</a>:</h4>
<p>The <code>+local</code> portion is handled by the "rustup wrapper".  The binary in <code>~/.cargo/bin/cargo</code> is actually rustup, and it checks the argument list for the <code>+</code> override.  That is why cargo does not know about it.</p>



<a name="238515245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Building%20cargo%20with%20toolchain%20support/near/238515245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Will Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html#238515245">(May 12 2021 at 17:44)</a>:</h4>
<p>Thanks <span class="user-mention" data-user-id="120518">@Eric Huss</span>!</p>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> you have been duly disregarded</p>



<a name="238516237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Building%20cargo%20with%20toolchain%20support/near/238516237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html#238516237">(May 12 2021 at 17:51)</a>:</h4>
<p>I think you could use <code>rustup run local /other/cargo ...</code> to get the +local <code>RUSTC</code></p>



<a name="238516284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Building%20cargo%20with%20toolchain%20support/near/238516284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html#238516284">(May 12 2021 at 17:51)</a>:</h4>
<p>or even <code>rustup run local bash</code> and carry on from there</p>



<a name="238517700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Building%20cargo%20with%20toolchain%20support/near/238517700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html#238517700">(May 12 2021 at 18:01)</a>:</h4>
<p>I'm not sure rustup actually sets <code>RUSTC</code>. There's a proposal that it <em>should</em>: <a href="https://github.com/rust-lang/rustup/issues/2626">https://github.com/rust-lang/rustup/issues/2626</a></p>



<a name="238517914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Building%20cargo%20with%20toolchain%20support/near/238517914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html#238517914">(May 12 2021 at 18:02)</a>:</h4>
<div class="codehilite"><pre><span></span><code>$ diff -U0 &lt;(env | sort) &lt;(rustup run nightly env | sort)
--- /dev/fd/63  2021-05-12 11:01:53.686249757 -0700
+++ /dev/fd/62  2021-05-12 11:01:53.686249757 -0700
@@ -2,0 +3 @@
+CARGO_HOME=/home/josh/.cargo
@@ -38,0 +40 @@
+LD_LIBRARY_PATH=/home/josh/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib
@@ -47 +49 @@
-PATH=/home/josh/.local/bin:/home/josh/.cargo/bin:/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+PATH=/home/josh/.cargo/bin:/home/josh/.local/bin:/home/josh/.cargo/bin:/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
@@ -49,0 +52,3 @@
+RUSTUP_HOME=/home/josh/.rustup
+RUSTUP_TOOLCHAIN=nightly-x86_64-unknown-linux-gnu
+RUST_RECURSION_COUNT=1
@@ -66 +71 @@
-_=/usr/bin/env
+_=/home/josh/.cargo/bin/rustup
</code></pre></div>



<a name="238518066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Building%20cargo%20with%20toolchain%20support/near/238518066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html#238518066">(May 12 2021 at 18:03)</a>:</h4>
<p>It just sets <code>RUSTUP_TOOLCHAIN</code>, and then expects cargo to invoke <code>rustc</code> via the rustup wrapper such that the rustup wrapper for <code>rustc</code> will select the right <code>rustc</code>.</p>



<a name="238518086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Building%20cargo%20with%20toolchain%20support/near/238518086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Building.20cargo.20with.20toolchain.20support.html#238518086">(May 12 2021 at 18:03)</a>:</h4>
<p>So you still have to make sure rustup can find your <code>rustc</code> if you do that.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>